package TenBasicAlgorithm;
//汉诺塔分治法
public class DivideAndConquerDemo {
    public static int count=0;
    public static void main(String[] args) {
        Hanoi(5,'a','b','c');
        System.out.println(count);
    }
    public static void Hanoi(int num,char a,char b,char c){
        if(num==1){
            System.out.println(a+"->"+c);
            count++;
        }else{
            Hanoi(num-1,a,c,b);
            System.out.println("第"+num+"盘"+a+"->"+c);
            count++;
            Hanoi(num-1,b,a,c);
        }
    }
}
